<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  
  <title>Python Cgi笔记 | gdme1320 的笔记</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Table of Contents   Python CGI简单示例 简单的HTTP POST POST Body POST File Return Status Code 返回http状态码     Python CGI简单示例   #! /usr/bin/python3              # 执行此脚本的程序，确保路径正确，不要包含这个注释 import cgi import c">
<meta property="og:type" content="article">
<meta property="og:title" content="Python Cgi笔记">
<meta property="og:url" content="http://gdme1320.gitee.com/python/cgi/index.html">
<meta property="og:site_name" content="gdme1320 的笔记">
<meta property="og:description" content="Table of Contents   Python CGI简单示例 简单的HTTP POST POST Body POST File Return Status Code 返回http状态码     Python CGI简单示例   #! /usr/bin/python3              # 执行此脚本的程序，确保路径正确，不要包含这个注释 import cgi import c">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2022-03-23T09:59:19.013Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Python Cgi笔记">
<meta name="twitter:description" content="Table of Contents   Python CGI简单示例 简单的HTTP POST POST Body POST File Return Status Code 返回http状态码     Python CGI简单示例   #! /usr/bin/python3              # 执行此脚本的程序，确保路径正确，不要包含这个注释 import cgi import c">
  
    <link rel="alternate" href="/atom.xml" title="gdme1320 的笔记" type="application/atom+xml">
  
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">

  <link rel="stylesheet" href="/css/styles.css">
  <link rel="stylesheet" href="/css/docs.min.css">
  

</head>
</html>
<body>
  <nav class="navbar navbar-inverse">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-menu-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="main-menu-navbar">
      <ul class="nav navbar-nav">
        
          <li><a class href="/index.html">Home</a></li>
        
          <li><a class href="/archives/">Archives</a></li>
        
      </ul>

      <!--
      <ul class="nav navbar-nav navbar-right">
        
          <li><a href="/atom.xml" title="RSS Feed"><i class="fa fa-rss"></i></a></li>
        
      </ul>
      -->
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

  <div class="container bs-docs-container">
  
    <div class="row">
        <div class="col-sm-8 blog-main">
          <article id="post-python/cgi" class="article article-type-post" itemscope itemprop="blogPost">

  <header class="article-header">
    
  
    <h1 class="article-title" itemprop="name">
      Python Cgi笔记
    </h1>
  


  </header>

  <div class="article-meta">
    <div class="article-datetime">
  <a href="/python/cgi/" class="article-date"><time datetime="2022-03-23T09:59:19.013Z" itemprop="datePublished">2022-03-23</time></a>
</div>

    
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/python/">python</a>
  </div>


  </div>
  <div class="article-inner">

    <div class="article-entry" itemprop="articleBody">
      
        
<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org8f7b105">Python CGI简单示例</a></li>
<li><a href="#org3ded2ac">简单的HTTP POST</a></li>
<li><a href="#orgcf86c6c">POST Body</a></li>
<li><a href="#orgd98dacd">POST File</a></li>
<li><a href="#orgff47b02">Return Status Code 返回http状态码</a></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org8f7b105">
<h2 id="org8f7b105">Python CGI简单示例</h2>
<div class="outline-text-2" id="text-org8f7b105">
<div class="org-src-container">
<pre class="src src-python" id="orga37cdfe"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">! /usr/bin/python3              # 执行此脚本的程序，确保路径正确，不要包含这个注释</span>
<span style="font-weight: bold;">import</span> cgi
<span style="font-weight: bold;">import</span> cgitb                     <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">用于显示错误</span>
cgitb.enable()

<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Content-Type: text/palin"</span>)<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Response Header</span>
<span style="font-weight: bold;">print</span>()                          <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Response header end，使用一个换行符表示响应头部的结束，HTTP协议中的定义</span>
<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"CGI worked"</span>)
<span style="font-weight: bold;">print</span>()
</pre>
</div>
<p>
使用支持CGI的Web服务器，以Apache为例，将脚本放置在目录。
假如Apache服务器以apache用户运行，需要赋予脚本apache用户的执行权限。
</p>
<p>
故障排除方法：
</p>
<ul class="org-ul">
<li>检查脚本能否执行：  sudo -u apache /var/www/cgi-bin/hello.py </li>
<li>404: web服务器是否开启了cgi功能；cgi配置的访问路径，例如ubuntu1804上的apache2服务器，默认配置的话，我通过src_shell[curl localhots/cgi-bin/hello.py]访问。</li>
<li>如果服务器返回500，通过web服务器的日志查看错误，根据web服务器的配置找到error_log的位置，apache服务器一般位于/var/log/apache</li>
<li>End of script output before headers. 出现这种问题，一般是脚本抛出了异常，异常信息出现在print response header之前。</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org3ded2ac">
<h2 id="org3ded2ac">简单的HTTP POST</h2>
<div class="outline-text-2" id="text-org3ded2ac">
<p>
以下是我自用的一个使用了POST的脚本。
</p>
<div class="org-src-container">
<pre class="src src-python"><span style="font-weight: bold;">import</span> cgi
<span style="font-weight: bold;">import</span> cgitb
cgitb.enable()
<span style="font-weight: bold;">import</span> os, sys

<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Content-Type: text/plain"</span>)
<span style="font-weight: bold;">print</span>()

<span style="font-weight: bold; font-style: italic;">form</span> = cgi.FieldStorage() <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">这个form中存储了POST表单</span>

<span style="font-weight: bold; font-style: italic;">vm_ip</span> = form.getvalue(<span style="font-style: italic;">"ip"</span>) <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">获取Form表单中名字为ip的字段的值</span>
<span style="font-weight: bold;">if</span> vm_ip <span style="font-weight: bold;">is</span> <span style="font-weight: bold; text-decoration: underline;">None</span> <span style="font-weight: bold;">or</span> <span style="font-weight: bold;">len</span>(vm_ip) == 0:
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Empty form field: ip"</span>)
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Result: False"</span>)
    <span style="font-weight: bold; text-decoration: underline;">exit</span>()

<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">执行业务逻辑了       </span>
<span style="font-weight: bold; font-style: italic;">data_dir</span> = os.path.join(sys.path[0], <span style="font-style: italic;">'data'</span>)
<span style="font-weight: bold;">if</span> <span style="font-weight: bold;">not</span> os.path.isdir(data_dir):
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Data dir not exists: %s"</span> % data_dir)
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Result: False"</span>)
    <span style="font-weight: bold; text-decoration: underline;">exit</span>()
<span style="font-weight: bold; font-style: italic;">fd</span> = <span style="font-weight: bold;">open</span>(os.path.join(data_dir, <span style="font-style: italic;">"cm-hyper-v-ip"</span>), <span style="font-style: italic;">'w'</span>)
fd.write(vm_ip)
fd.close()

<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Result: True"</span>)
</pre>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-orgcf86c6c">
<h2 id="orgcf86c6c">POST Body</h2>
<div class="outline-text-2" id="text-orgcf86c6c">
<div class="org-src-container">
<pre class="src src-python"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">! /usr/bin/python3</span>

<span style="font-weight: bold;">import</span> cgi, os, sys
<span style="font-weight: bold;">import</span> cgitb                     <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">用于显示错误</span>
cgitb.enable()

<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Content-Type: text/plain"</span>)<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Response Header</span>
<span style="font-weight: bold;">print</span>()                          <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">Response header end，使用一个换行符表示响应头部的结束，HTTP协议中的定义</span>

<span style="font-weight: bold;">if</span> <span style="font-style: italic;">"CONTENT_TYPE"</span> <span style="font-weight: bold;">in</span> os.environ:
    <span style="font-weight: bold; font-style: italic;">cont_len</span> = <span style="font-weight: bold;">int</span>(os.environ[<span style="font-style: italic;">"CONTENT_LENGTH"</span>])
    <span style="font-weight: bold; font-style: italic;">body</span> = sys.stdin.read(cont_len)
    <span style="font-weight: bold;">print</span>(body)
    <span style="font-weight: bold;">print</span>()
<span style="font-weight: bold;">else</span>:
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Body is empty"</span>)
</pre>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-orgd98dacd">
<h2 id="orgd98dacd">POST File</h2>
<div class="outline-text-2" id="text-orgd98dacd">
<div class="org-src-container">
<pre class="src src-python"><span style="font-weight: bold; font-style: italic;">#</span><span style="font-weight: bold; font-style: italic;">! /usr/bin/python3</span>
<span style="font-weight: bold;">import</span> cgi, os, sys
<span style="font-weight: bold;">import</span> cgitb; cgitb.enable()
<span style="font-weight: bold; font-style: italic;">DATA_DIR</span>=<span style="font-style: italic;">"/data/www-data/file-upload"</span>
<span style="font-weight: bold; font-style: italic;">form</span> = cgi.FieldStorage()
<span style="font-weight: bold; font-style: italic;">fileitem</span> = form[<span style="font-style: italic;">'file'</span>] <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">form input name</span>
<span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"Content-Type: text/plain"</span>)
<span style="font-weight: bold;">print</span>()
<span style="font-weight: bold;">if</span> fileitem.filename:
    <span style="font-weight: bold; font-style: italic;">local_path</span> = os.path.join(DATA_DIR, fileitem.filename)
    <span style="font-weight: bold; font-style: italic;">fd</span> = <span style="font-weight: bold;">open</span>(local_path, <span style="font-style: italic;">'wb'</span>) <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">open for write in binary mode</span>
    <span style="font-weight: bold; font-style: italic;">data</span> = fileitem.<span style="font-weight: bold;">file</span>.read() <span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">read file stream</span>
    fd.write(data)
    fd.close()
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"File writeen to %s"</span> % local_path)
<span style="font-weight: bold;">else</span>:
    <span style="font-weight: bold;">print</span>(<span style="font-style: italic;">"No file found"</span>)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-html">&lt;<span style="font-weight: bold;">html</span>&gt;
        &lt;<span style="font-weight: bold;">head</span>&gt;
                &lt;<span style="font-weight: bold;">title</span>&gt;<span style="font-weight: bold; text-decoration: underline;">File Upload</span>&lt;/<span style="font-weight: bold;">title</span>&gt;
        &lt;/<span style="font-weight: bold;">head</span>&gt;
        &lt;<span style="font-weight: bold;">body</span>&gt;
                &lt;<span style="font-weight: bold;">form</span> <span style="font-weight: bold; font-style: italic;">action</span>=<span style="font-style: italic;">"/cgi-bin/file-upload.py"</span> <span style="font-weight: bold; font-style: italic;">method</span>=<span style="font-style: italic;">"POST"</span> <span style="font-weight: bold; font-style: italic;">enctype</span>=<span style="font-style: italic;">"multipart/form-data"</span>&gt;
                        &lt;<span style="font-weight: bold;">input</span> <span style="font-weight: bold; font-style: italic;">type</span>=<span style="font-style: italic;">"file"</span> <span style="font-weight: bold; font-style: italic;">name</span>=<span style="font-style: italic;">"file"</span> /&gt;
                        &lt;<span style="font-weight: bold;">input</span> <span style="font-weight: bold; font-style: italic;">type</span>=<span style="font-style: italic;">"submit"</span> <span style="font-weight: bold; font-style: italic;">value</span>=<span style="font-style: italic;">"Upload"</span> /&gt;
                &lt;/<span style="font-weight: bold;">form</span>&gt;
        &lt;/<span style="font-weight: bold;">body</span>&gt;
&lt;/<span style="font-weight: bold;">html</span>&gt;
</pre>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-orgff47b02">
<h2 id="orgff47b02">Return Status Code 返回http状态码</h2>
<div class="outline-text-2" id="text-orgff47b02">
<p>
<a href="https://stackoverflow.com/questions/833715/returning-http-status-codes-in-python-cgi" target="_blank" rel="noopener">https://stackoverflow.com/questions/833715/returning-http-status-codes-in-python-cgi</a>
</p>
<div class="org-src-container">
<pre class="src src-python" id="org5d75a85">
<span style="font-weight: bold;">print</span> <span style="font-style: italic;">"Status:301\nLocation: http://www.google.com"</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">print("Status: 400")</span>
<span style="font-weight: bold; font-style: italic;"># </span><span style="font-weight: bold; font-style: italic;">print("Status: 401")</span>

</pre>
</div>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer" target="_blank" rel="noopener">Validate</a></p>
</div>

      
    </div>

    
      

    

    <footer class="article-footer">
      <a data-url="http://gdme1320.gitee.com/python/cgi/" data-id="cl13eo7k4008phjv4hxi9crc8" class="article-share-link">
        <i class="fa fa-share"></i> Share
      </a>
      
      

    </footer>
  </div>
  
    
<ul id="article-nav" class="nav nav-pills nav-justified">
  
  <li role="presentation">
    <a href="/python/simple-http-server/" id="article-nav-older" class="article-nav-link-wrap">
      <i class="fa fa-chevron-left pull-left"></i>
      <span class="article-nav-link-title">启动一个简单的Http Server</span>
    </a>
  </li>
  
  
  <li role="presentation">
    <a href="/python/snippets/" id="article-nav-newer" class="article-nav-link-wrap">
      <span class="article-nav-link-title">Python Snippets</span>
      <i class="fa fa-chevron-right pull-right"></i>
    </a>
  </li>
  
</ul>


  
</article>




        </div>
        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          
  
  <div class="sidebar-module">
    <h4>Categories</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/apps/">apps</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/architecture/">architecture</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/">devops</a><span class="sidebar-module-list-count">10</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubectl/">kubectl</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubernetes/">kubernetes</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/">dotnet</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/entityframework/">entityframework</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/elasticsearch/">elasticsearch</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/">emacs</a><span class="sidebar-module-list-count">4</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/org-mode/">org-mode</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/git/">git</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/graphql/">graphql</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/groovy/">groovy</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/">java</a><span class="sidebar-module-list-count">52</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/concurrent/">concurrent</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/jackson/">jackson</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/shiro/">shiro</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring/">spring</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/">spring-amqp</a><span class="sidebar-module-list-count">5</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-security/">spring-security</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/">thymeleaf</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/maven/">maven</a><span class="sidebar-module-list-count">1</span></li></ul></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/jenkins/">jenkins</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/journal/">journal</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/js/">js</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/">linux</a><span class="sidebar-module-list-count">35</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kde/">kde</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/">kross</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/ktorrent-scripts/">ktorrent-scripts</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/shell/">shell</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/tcp/">tcp</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/lisp/">lisp</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mongodb/">mongodb</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mssql/">mssql</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mysql/">mysql</a><span class="sidebar-module-list-count">12</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/nginx/">nginx</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/node/">node</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/">postgresql</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/client/">client</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/python/">python</a><span class="sidebar-module-list-count">19</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/regex/">regex</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/rfc/">rfc</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/vim/">vim</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/windows/">windows</a><span class="sidebar-module-list-count">7</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tags</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/ReentrantLock/">ReentrantLock</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/nohup/">nohup</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/pandoc/">pandoc</a><span class="sidebar-module-list-count">1</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tag Cloud</h4>
    <p class="tagcloud">
      <a href="/tags/ReentrantLock/" style="font-size: 10px;">ReentrantLock</a> <a href="/tags/nohup/" style="font-size: 10px;">nohup</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a>
    </p>
  </div>


  
  <div class="sidebar-module">
    <h4>Archives</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2919/06/">June 2919</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/03/">March 2022</a><span class="sidebar-module-list-count">58</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/01/">January 2022</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/11/">November 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/10/">October 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/04/">April 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/03/">March 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/02/">February 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/01/">January 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/12/">December 2020</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/11/">November 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/10/">October 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/09/">September 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/07/">July 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/06/">June 2020</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/04/">April 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/03/">March 2020</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/02/">February 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/01/">January 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/12/">December 2019</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/11/">November 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/10/">October 2019</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/09/">September 2019</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/08/">August 2019</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/07/">July 2019</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/06/">June 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/05/">May 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/04/">April 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/03/">March 2019</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/02/">February 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/01/">January 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/11/">November 2018</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/10/">October 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/08/">August 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/07/">July 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/06/">June 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/03/">March 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/07/">July 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/06/">June 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/04/">April 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2015/05/">May 2015</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/1970/01/">January 1970</a><span class="sidebar-module-list-count">9</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Recents</h4>
    <ul class="sidebar-module-list">
      
        <li>
          <a href="/java/acessing-generic-types-at-runtime/">获取泛型类型</a>
        </li>
      
        <li>
          <a href="/linux/shell/bash_cgi/">Script for Shell Parsing Parameters</a>
        </li>
      
        <li>
          <a href="/linux/shell/shell-script/">Shell Script Getting Start</a>
        </li>
      
        <li>
          <a href="/linux/tcp/network-tcp-performance-turning-with-sysctl/">【翻译】Sysctl调节Linux网络性能</a>
        </li>
      
        <li>
          <a href="/java/concurrent/aqs-src/">AQS源码笔记</a>
        </li>
      
    </ul>
  </div>



        </div>
    </div>
  </div>
  <footer class="blog-footer">
  <div class="container">
    <div id="footer-info" class="inner">
      &copy; 2022 gdme1320<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

  

<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script> -->

<script src="/js/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>



<script src="/js/script.js"></script>

</body>
</html>
